#include "word.h"
#include "project.h"

using namespace TA;

Word::Word(QObject *parent) : QObject(parent)
{
    init(parent,QString(""));
}

Word::Word(QObject *parent,const QString& uuid):QObject(parent){
    init(parent,uuid);
}

Word::Word(const Word &rhs):QObject(rhs.parent())
{
   *this = rhs;
}

void Word::init(QObject *p,const QString& uuid){
    Project* project = qobject_cast<Project*>(p);
    if(project){
        this->project = project;
    }
    if(!uuid.isEmpty()){
        this->uuid = uuid;
    }
}

WordPositionRawPtrArray& Word::getPositions()
{
    return positions;
}

void Word::setPositions(const WordPositionRawPtrArray &value)
{
    positions = value;
}

QString Word::getUuid() const
{
    return uuid;
}

void Word::setUuid(const QString &value)
{
    uuid = value;
}

QString Word::getWord() const
{
    return word;
}

void Word::setWord(const QString &value)
{
    word = value;
}

int Word::getLength() const
{
    return length;
}

void Word::setLength(int value)
{
    length = value;
}

WordType Word::getType() const
{
    return type;
}

void Word::setType(const WordType &value)
{
    type = value;
}

WordStatus Word::getStatus() const
{
    return status;
}

void Word::setStatus(const WordStatus &value)
{
    status = value;
}

Project *Word::getProject() const
{
    return project;
}

void Word::setProject(Project *value)
{
    project = value;
}


bool Word::operator==(const Word &other) const
{
    return this->word == other.word && this->project == other.project;
}

bool Word::operator!=(const Word &other) const
{
    return this->word!=other.word || this->project != other.project;
}

bool Word::operator<(const Word &other) const
{
    return this->word<other.word;
}

Word &Word::operator=(const Word &rhs)
{
    this->uuid = rhs.uuid;
    this->length = rhs.length;
    this->type = rhs.type;
    this->status = rhs.status;
    this->project = rhs.project;
    this->positions = rhs.positions;
    return *this;
}
